define(function(require, exports, module)
{
	var $ = require("$");
	require('bootstrap_commonrequire');

	var form_tpl = require("./auditing.tpl");
	var Widget = require("widget");
	var handlebars = require("handlebars");

	var modaldialog = Widget.extend(
	{
		handlebars : handlebars,
		template : form_tpl,
		// 初始化参数
		initCustAttr : function()
		{
		},
		afterRender : function()
		{
			var passaction = this.get("passaction");
			var backaction = this.get("backaction");
			$('#authosize').modal('hide');
			if (passaction)
				$("#btndialogpass").on("click", function(e)
				{
					var text = $("#auditing_text").val();
					passaction(text);
					$("#waiting").show();
				});
			if (backaction)
				$("#btndialogback").on("click", function(e)
				{
					var text = $("#auditing_text").val();
					backaction(text);
					$("#waiting").show();
				});
		}
	});

	exports.init = function(param)
	{
		new modaldialog(
		{
			attrs :
			{
				id : "authosize",
				title : param.title,
				passaction : param.passaction,
				backaction : param.backaction
			},
			renderTo : param.renderTo
		});
		$('#authosize').modal('show');
	};
});
